package com.bwie.parkdemo.mvvm.model.entity;

import com.bwie.lib_core.base.BaseEntity;
import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * 全部申请列表实体
 *  {\"applyTime\":\"2020-03-13\",\"parkId\":0,\"repairId\":0,
 *  \"state\":0,\"title\":\"来访:添加描述\",\"type\":0,\"visitorId\":66}
 * */
public class SelAllApplyEntity extends BaseEntity {
    public String values;
    private List<Object>datas;

    public List<Object> getDatas() {
        datas = new ArrayList<>();
        try {
            JSONArray jay = new JSONArray(values);
            for (int i = 0;i < jay.length();i ++){
                String jsonStr = jay.getJSONObject(i).toString();
                Values entity = new Gson().fromJson(jsonStr,Values.class);
                datas.add(entity);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return datas;
    }

    public static class Values{

        public String applyTime;
        public int parkId;
        public int repairId;
        public int state;
        public String title;
        public int type;//0,1,2
        public int visitorId;
    }

}
